/**
 * 认证相关路由
 */
const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');
const authenticate = require('../middleware/auth');
const validator = require('../middleware/validator');

// 用户注册
router.post(
  '/register', 
  validator.validateRequired(['username', 'password']),
  authController.register
);

// 用户登录
router.post(
  '/login', 
  validator.validateRequired(['username', 'password']),
  authController.login
);

// 获取用户资料
router.get(
  '/profile', 
  authenticate,
  authController.getProfile
);

// 更新用户资料
router.put(
  '/profile', 
  authenticate,
  authController.updateProfile
);

module.exports = router; 